package src.accenture.com.entity;

import java.io.Serializable;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedNativeQueries;
import javax.persistence.NamedNativeQuery;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@NamedQueries( { @NamedQuery(name = "MblRole.findAll", query = "select o from MblRole o") })
@Table(name = "MBL_ROLE")
@NamedNativeQueries( { @NamedNativeQuery(name = 
                                         "MblRole.addNewRole", 
                                         query = 
                                         " INSERT INTO MBL_ROLE(ROLE_ID, ROLE_NAME, DESCRIBE) \n" + 
                                         " VALUES(?role_id, ?role_name, ?describe) ")
        } )
public class MblRole implements Serializable {
    @Column(length = 4000)
    private String describe;
    @Id
    @Column(name = "ROLE_ID", nullable = false, length = 10)
    private String roleId;
    @Column(name = "ROLE_NAME", length = 4000)
    private String roleName;
    @OneToMany(mappedBy = "mblRole")
    private List<MblEmployee> mblEmployeeList1;

    public MblRole() {
    }

    public MblRole(String describe, String roleId, String roleName) {
        this.describe = describe;
        this.roleId = roleId;
        this.roleName = roleName;
    }

    public String getDescribe() {
        return describe;
    }

    public void setDescribe(String describe) {
        this.describe = describe;
    }

    public String getRoleId() {
        return roleId;
    }

    public void setRoleId(String roleId) {
        this.roleId = roleId;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public List<MblEmployee> getMblEmployeeList1() {
        return mblEmployeeList1;
    }

    public void setMblEmployeeList1(List<MblEmployee> mblEmployeeList1) {
        this.mblEmployeeList1 = mblEmployeeList1;
    }

    public MblEmployee addMblEmployee(MblEmployee mblEmployee) {
        getMblEmployeeList1().add(mblEmployee);
        mblEmployee.setMblRole(this);
        return mblEmployee;
    }

    public MblEmployee removeMblEmployee(MblEmployee mblEmployee) {
        getMblEmployeeList1().remove(mblEmployee);
        mblEmployee.setMblRole(null);
        return mblEmployee;
    }
}
